package com.nuanshui.heatedloan.fund.biz.service;

import com.nuanshui.framework.consts.TransactionManagerType;
import com.nuanshui.heatedloan.baseservice.service.CommonServiceImpl;
import com.nuanshui.heatedloan.fund.biz.dal.mapper.UserBindAccountMapper;
import com.nuanshui.heatedloan.fund.facade.UserBindAccountService;
import com.nuanshui.heatedloan.fund.model.UserAccount;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;



@Service
@Transactional(readOnly=true,value=TransactionManagerType.FUND_TRANSACTION_MANAGER)
public class UserBindAccountServiceImpl extends CommonServiceImpl implements UserBindAccountService {

	@Autowired
	private UserBindAccountMapper userBindAccountMapper;
	@Override 
	@Transactional(value=TransactionManagerType.FUND_TRANSACTION_MANAGER)
	public void bindPayAccount(UserAccount userAccount) {

		userBindAccountMapper.unBindPayAccount(userAccount);
		userBindAccountMapper.bindPayAccount(userAccount);
	}

	@Override
	@Transactional(value=TransactionManagerType.FUND_TRANSACTION_MANAGER)
	public void unBindPayAccount(UserAccount userAccount) {

		userBindAccountMapper.unBindPayAccount(userAccount);
	}

	@Override
	public UserAccount loadUserPayAccount(String userId, Integer accountType) {
		return userBindAccountMapper.loadUserPayAccount(userId,accountType);
	}

	@Override
	public UserAccount loadPayAccountByBizId(String bizId) {
		return userBindAccountMapper.loadPayAccountByBizId(bizId);
	}

	@Override
	public UserAccount loadPayAccountById(String accountId) {
		return userBindAccountMapper.loadPayAccountById(accountId);
	}

}
